<?
$param = PARAMS;
$subpage = $page->subpages->$param->$lang;
?>
<hgroup><?=$subpage->title ? '<h2>'.TITLE.'</h2> / <h1>'.$subpage->title.'</h1>' : '<h1>'.TITLE.'</h1>'?></hgroup>
<h2 class="none"><?=DESCRIPTION?></h2>
<?if($param != 'default'):
$media = $page->subpages->$param->media;
?>
<div id="album">
<?if($media) foreach($media as $k=>$i):?>
<div id="<?=$k?>" class="image">
    <a class="thumb" href="/<?=$i->src?>" title="<?=$i->alt?>">
        <img src="/<?=$i->thumb?>" alt="<?=$i->alt?>" />
    </a>
    <div id="<?=$k?>" class="name"><?=$i->alt?></div>
</div>
<?endforeach;?>
<div class="clear"></div>
</div>
<script src="//<?=COOKIELESS?>/lib/js/ubox-min.js"></script>
<script>
$('#page .thumb').ubox();
$('#album img').load(function(){ $('#album').masonry({ singleMode: true }); });
</script>
<?else:?>
<menu id="albums">
<?foreach ($page->subpages as $k=>$i):  $m = key($i->media);?> 
<div id="<?=$m?>" class="album">
    <a class="thumb" href="/<?=PAGE?>/<?=$k?>">
        <img src="/<?=$i->media->$m->thumb?>" alt="<?=$i->media->$m->alt?>" />
    </a>
    <div class="name"><?=$i->$lang->title?></div>
</div>
<?endforeach;?>
<div class="clear"></div>
</menu>
<script>
$('#albums img').load(function(){ $('#albums').masonry({ singleMode: true }); });
</script>
<?endif;?>
<div class="clear"></div>